package {
	import flash.display.Sprite;
	
	import org.deft.tween.DEasing;
	import org.deft.tween.DTween;
	import org.deft.tween.DTweenEvent;
	import org.deft.tween.DTweenQueue;

	public class Demo2 extends Sprite {
		public function Demo2() {
			var b3:Sprite = new Ball(10, 100);
			addChild(b3);

			//动画队列事例
			
			var t1:DTween = new DTween(b3);
			t1.modifyProp("x", b3.x, b3.x + 200, 3000);

			var t2:DTween = new DTween(b3);
			t2.modifyProp("alpha", 1, 0, 1000);

			var t3:DTween = new DTween(b3);
			t3.modifyProp("alpha", 0, 1, 1000);
			
			var t4:DTween = new DTween(b3, 6, true);
			t4.modifyProp("scaleX", 1, 2, 1000, DEasing.easeInSine);
			t4.modifyProp("scaleY", 1, 2, 1000, DEasing.easeInSine);
				

			var queue:DTweenQueue = new DTweenQueue();
			queue.add(t1);
			queue.add(t2);
			queue.add(t3);
			queue.add(t4);

			queue.start();
			queue.addEventListener(DTweenEvent.MOTION_FINISH_ALL, function(e:DTweenEvent):void {
				trace("finished:", queue.duration);
				queue.start();
			});
		}
	}
}